home *** CD-ROM | disk | FTP | other *** search
- property pTimer, pField, spriteNum, pbufferList, pAvgSize, pLastFrameRate
-
- on beginSprite me
- pAvgSize = 100
- pLastFrameRate = 0
- pTimer = the milliSeconds
- pField = sprite(spriteNum).member.name
- pbufferList = []
- repeat with n = 1 to pAvgSize
- add(pbufferList, n)
- end repeat
- end
-
- on exitFrame me
- thisframe = 1000.0 / (the milliSeconds - pTimer)
- add(pbufferList, thisframe)
- deleteAt(pbufferList, 1)
- theSum = 0
- repeat with n = 1 to pAvgSize
- theSum = theSum + pbufferList[n]
- end repeat
- avg = integer(theSum / float(pAvgSize))
- if avg <> pLastFrameRate then
- pLastFrameRate = avg
- put string(avg) into field pField
- end if
- pTimer = the milliSeconds
- end
-